add_definitions(-DMACRO_WIN)
# add_definitions(-DCC_EXPORTS)
# set( my_std_pre "/std:" )

# set( basic_cxx17 "c++17" )
# set( str_cxx17 "${my_std_pre}${basic_cxx17}" )

# include( CheckCXXCompilerFlag )
# check_cxx_compiler_flag( "${str_cxx17}" _cpp_17_flag_supported )
# if ( _cpp_17_flag_supported )
#     set( CMAKE_CXX_STANDARD 17 )
#     message("_cpp_17_flag_supported")
# else()
# message("_cpp_17_flag_no_supported")
# endif()

include_directories(
    include
    vendor
    vendor/Glad/include
    vendor/imgui
    vendor/spdlog/include
    # vendor/entt/include
    vendor/assimp
    vendor/bullet
    vendor/freetype2
    vendor/shaderc/include
    vendor/ffmpeg/include
    src   
    src/App
    )
   
SET(SOURCE
    src/App/Sandbox.cpp
    src/App/SandboxApp.cpp
    src/App/ProjectSandbox.cpp
    src/App/finddesktop.cpp
)

link_directories( ${PROJECT_NAME}
    PRIVATE
    lib/win
    )

message("====win======" ${PROJECT_SOURCE_DIR})

if(${MYBUILD_TYPE_DEBUG})
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")

# add_library(${PROJECT_NAME} STATIC ${SOURCE})
add_executable(${PROJECT_NAME} ${SOURCE})

target_link_libraries( ${PROJECT_NAME}
    PRIVATE    
    ${PROJECT_SOURCE_DIR}/lib/win/debug/BulletCollision_Debug.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/BulletDynamics_Debug.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/LinearMath_Debug.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/BulletInverseDynamics_Debug.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/BulletSoftBody_Debug.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/freetype.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/assimpd.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/glfw3.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/shaderc.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/glslangd.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/shaderc_util.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/SPIRVd.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/HLSLd.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/SPIRV-Tools.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/SPIRV-Tools-opt.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/MachineIndependentd.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/GenericCodeGend.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/OSDependentd.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/OGLCompilerd.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/CCEngine.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/avcodec.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/avfilter.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/avformat.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/avutil.lib
    ${PROJECT_SOURCE_DIR}/lib/win/debug/swscale.lib
    # ${PROJECT_SOURCE_DIR}/lib/win/spdlog.lib
    )

# install(FILES
#     ${PROJECT_SOURCE_DIR}/build_win/Debug/SmallEngine.dll
#     DESTINATION
#     ${PROJECT_SOURCE_DIR}/../Sandbox/build_win/Debug
# )

else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")

# add_library(${PROJECT_NAME} STATIC ${SOURCE})
add_executable(${PROJECT_NAME} ${SOURCE})

target_link_libraries( ${PROJECT_NAME}
    PRIVATE    
    ${PROJECT_SOURCE_DIR}/lib/win/release/BulletCollision.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/BulletDynamics.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/LinearMath.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/BulletInverseDynamics.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/BulletSoftBody.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/freetype.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/assimp.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/glfw3.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/CCEngine.lib
    # ${PROJECT_SOURCE_DIR}/lib/win/spdlog.lib    
    ${PROJECT_SOURCE_DIR}/lib/win/release/shaderc.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/glslang.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/shaderc_util.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/SPIRV.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/HLSL.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/SPIRV-Tools.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/SPIRV-Tools-opt.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/MachineIndependent.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/GenericCodeGen.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/OSDependent.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/OGLCompiler.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/avcodec.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/avfilter.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/avformat.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/avutil.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/swscale.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/avdevice.lib
    ${PROJECT_SOURCE_DIR}/lib/win/release/postproc.lib
    )

endif()

